<?php 
require_once("../class/NewsList.php");
require_once("../class/PrayList.php");
require_once("../class/Tool.php");

$newlist = new NewsList(5); 
$praylist = new PrayList(5); 

if ($_POST["type"] == "news")
{
	if(isset($_POST["nid"]))
	{
		$newlist->delNews($_POST["nid"]);
		$post_data = array('return_message' => 'Delete Success!', 'page' => $_POST["page"]);
	}else
	{
		$post_data = array('return_message' => 'Delete Fail!', 'page' => $_POST["page"]);
	}
	Tool::redirect_post("news_admin.php", $post_data);
}
else if ($_POST["type"] == "pray")
{
	if(isset($_POST["pid"]))
	{
		$praylist->delPray($_POST["pid"]);
		$post_data = array('return_message' => 'Delete Success!', 'page' => $_POST["page"]);
	}else
	{
		$post_data = array('return_message' => 'Delete Fail!', 'page' => $_POST["page"]);
	}
	Tool::redirect_post("pray_admin.php", $post_data);
}
?>